package domain.entities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * DocumentoCentro entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "documento_centro", catalog = "bms")
public class DocumentoCentro implements java.io.Serializable {

	// Fields

	private Integer id;
	private ProtocoloCentro protocoloCentro;
	private Set<Traduccion> traduccions = new HashSet<Traduccion>(0);

	// Constructors

	/** default constructor */
	public DocumentoCentro() {
	}

	/** minimal constructor */
	public DocumentoCentro(ProtocoloCentro protocoloCentro) {
		this.protocoloCentro = protocoloCentro;
	}

	/** full constructor */
	public DocumentoCentro(ProtocoloCentro protocoloCentro,
			Set<Traduccion> traduccions) {
		this.protocoloCentro = protocoloCentro;
		this.traduccions = traduccions;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "PROTOCOLO_CENTROCENTROid", referencedColumnName = "CENTROid", nullable = false),
			@JoinColumn(name = "protocolo_centroprotocolo_compromisopaisprotocoloid", referencedColumnName = "protocolo_compromisopaisprotocoloid", nullable = false),
			@JoinColumn(name = "protocolo_centroprotocolo_compromisopaiscompromisopaisid", referencedColumnName = "protocolo_compromisopaiscompromisopaisid", nullable = false) })
	public ProtocoloCentro getProtocoloCentro() {
		return this.protocoloCentro;
	}

	public void setProtocoloCentro(ProtocoloCentro protocoloCentro) {
		this.protocoloCentro = protocoloCentro;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "documentoCentro")
	public Set<Traduccion> getTraduccions() {
		return this.traduccions;
	}

	public void setTraduccions(Set<Traduccion> traduccions) {
		this.traduccions = traduccions;
	}

}